package leetcode.code1491;

import leetcode.IDebug;
import leetcode.helper.H;

public class Solution implements IDebug {

	public double average(int[] salary) {
		int max = Integer.MIN_VALUE;
		int min = Integer.MAX_VALUE;
		int sum = 0;
		int len = salary.length;
		for (int i = 0; i < len; i++) {
			int cur = salary[i];
			sum += cur;
			max = Math.max(max, cur);
			min = Math.min(min, cur);
		}
		return (double) (sum - max - min) / (len - 2);
	}

	@Override
	public void debug4() {
		H.compare(4111.1111, this.average(H.str2array3(
				"[48000,59000,99000,13000,78000,45000,31000,17000,39000,37000,93000,77000,33000,28000,4000,54000,67000,6000,1000,11000]")));

	}

	@Override
	public void debug3() {
		// TODO Auto-generated method stub

	}

	@Override
	public void debug2() {
		// TODO Auto-generated method stub

	}

	@Override
	public void debug1() {
		// TODO Auto-generated method stub

	}

	public static void main(String[] args) {
		// TODO Auto-generated method stub

	}

}
